home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1997 August / Walnut Creek CDROM.7z / LISTINGS / V_13_05 / ALLISON.ZIP / TDATE5.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-13  |  519 b   |  28 lines

  1. LISTING 14 - Uses some Date comparison operators
  2. // tdate5.cpp
  3.  
  4. #include <iostream.h>
  5. #include "date3.h"
  6.  
  7. main()
  8. {
  9.     Date d1(10,1,1951), d2(3,7,1995);
  10.  
  11.     cout << "d1 == " << d1 << endl;
  12.     cout << "d2 == " << d2 << endl;
  13.  
  14.     cout << "d1 "
  15.          << ((d1 < d2) ? "precedes"
  16.                        : (d1 > d2) ? "follows"
  17.                                    : "equals")
  18.          << " d2" << endl;
  19.     return 0;
  20. }
  21.  
  22. /* Output:
  23. d1 == October 1, 1951
  24. d2 == March 7, 1995
  25. d1 precedes d2
  26. */
  27.  
  28.